import { createRouter, createWebHashHistory } from 'vue-router'
import Layout from '../Layout.vue'

const router = createRouter({
  history: createWebHashHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      redirect:"/login"
    },
    {
      path: '/',
      name: 'layout',
      component: Layout,
      alias: '/layout',
      children:[
        {
          path: '/index',
          name: 'index',
          component: () => import('../views/IndexView.vue')
        },
        {
          path: '/collect',
          name: 'collect',
          component: () => import('../views/CollectView.vue')
        },
        {
          path: '/home',
          name: 'home',
          component: () => import('../views/HomeView.vue')
        },
      ]
    },
    {
      path: '/search',
      name: 'search',
      component: () => import('../views/Search.vue')
    },
    {
      path: '/login',
      name: 'login',
      component: () => import('../views/LoginView.vue')
    },
    {
      path: '/register',
      name: 'register',
      component: () => import('../views/RegisterView.vue')
    },
    {
      path: '/detail',
      name: 'detail',
      component: () => import('../views/Detail.vue')
    },
    {
      path: '/set',
      name: 'set',
      component: () => import('../views/SetUser.vue')
    }
  ]
})

export default router
